PROJECT(Fluoro4030eSingle)

cmake_minimum_required(VERSION 2.8)

#to set advantech and Paxscan "find package"
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

FIND_PACKAGE(QT4 REQUIRED)
find_package (Advantech)
find_package (Paxscan)

if (QT4_FOUND)
  message (STATUS "Looking for Qt4 - found")
  include (${QT_USE_FILE})
else ()
  message (STATUS "Looking for Qt4 - not found")
endif ()


#Find ITk folder
#FIND_PACKAGE(ITK)
#IF(ITK_FOUND)
#   INCLUDE(${ITK_USE_FILE})
#ELSE(ITK_FOUND)
#   MESSAGE(FATAL_ERROR
#           "Cannot build without ITK.  Please set ITK_DIR.")
#ENDIF(ITK_FOUND)

SET(Fluoro4030eSingle_SOURCES
	main.cpp
	fluoro4030esingle.cpp	
	YK16GrayImage.cxx
	qyklabel.cpp
	qcustomplot.cpp
	advantech.cxx
	)

SET(Fluoro4030eSingle_HEADERS
	fluoro4030esingle.h
	YK16GrayImage.h
	qyklabel.h
	qcustomplot.h
	advantech.h
	)

SET(Fluoro4030eSingle_FORMS
	fluoro4030esingle.ui)

#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /subsystem:windows /ENTRY:mainCRTStartup")

QT4_WRAP_CPP(Fluoro4030eSingle_HEADERS_MOC ${Fluoro4030eSingle_HEADERS})

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

#QT4_WRAP_CPP(Fluoro4030eSingle_HEADERS_MOC ${Fluoro4030eSingle_HEADERS})
QT4_WRAP_UI(Fluoro4030eSingle_FORMS_HEADERS ${Fluoro4030eSingle_FORMS})
#QT4_ADD_RESOURCES(Fluoro4030eSingle_RESOURCES_RCC ${Fluoro4030eSingle_RESOURCES})

if (PAXSCAN_FOUND)
	include_directories (${PAXSCAN_INCLUDE_DIR})
endif ()

if (ADVANTECH_FOUND)
	include_directories (${ADVANTECH_INCLUDE_DIR})
endif()

ADD_EXECUTABLE(Fluoro4030eSingle ${Fluoro4030eSingle_SOURCES} 
	${Fluoro4030eSingle_HEADERS} 
    ${Fluoro4030eSingle_HEADERS_MOC} 
    ${Fluoro4030eSingle_FORMS_HEADERS} 
     )
#  ${imageprofiler4030e_RESOURCES_RCC}

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

SET(QT_USE_QTCORE TRUE)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)

#TARGET_LINK_LIBRARIES(ItkCon ${ITK_LIBRARIES} )
TARGET_LINK_LIBRARIES(Fluoro4030eSingle ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${ITK_LIBRARIES} ${PAXSCAN_LIBRARIES} ${ADVANTECH_LIBRARIES})